<template>
  <div class="myHead" :style="{background:backgroundColor}">
    <img v-show="backShow" src="../../../assets/img/zuojiantou.png" alt="" @click="back" class="myHead-img1">
    <span>{{title}}</span>
    <img :src="imgUrl" alt="" v-show="imgShow" class="myHead-img2" :style="{'width':imgSize[0],'height':imgSize[1]}" @click="Fn1">
    <p class="rightText" @click="Fn1" v-show="rightTextShow">{{rightText}}</p>
  </div>
</template>

<script>
  export default {
    name: "myHead",
    props: {
      title:{
        type:String,
        default:'标题'
      },
      imgShow:{
        type: Boolean,
        default: false
      },
      backShow:{
        type: Boolean,
        default: true
      },
      imgUrl:{
        type:String,
      },
      rightText:{
        type:String,
        default:'保存'
      },
      rightTextShow:{
        type:Boolean,
        default:false
      },
      imgSize:{
        type:Array,
        default:function () {
          return [];
        }
      },
      callBack:{
        type:Function
      },
      backgroundColor:{
        type:String,
        default:'linear-gradient(90deg,rgba(255,142,65,1) 0%,rgba(255,110,0,1) 100%)'
      }
    },
    methods: {
      back() {
        this.$router.back();
      },
      Fn1() {
        this.callBack()
      }
    }
  }
</script>

<style scoped>
  .myHead {
    width: 100%;
    position: fixed;
    top: -.01rem;
    left: 0;
    z-index: 999;
    height: .5rem;
    box-sizing: border-box;
    padding: 0 .13rem;
    background-size: cover;
    color: #ffffff;
    text-align: center;
    line-height: .5rem;
    font-size: .18rem;
    display: flex;
    flex-flow: row;
    align-items: center;
    justify-content: center;
  }

  .myHead-img1 {
    width: .10rem;
    height: .18rem;
    position: absolute;
    left: .13rem;
  }
  .myHead-img2 {
    position: absolute;
    right: .13rem;
  }
  .rightText {
    font-size:.15rem;
    font-family:PingFang SC;
    font-weight:500;
    color: #FFFFFF;
    position: absolute;
    right: .13rem;
  }
</style>
